<?php
$products_query = new WP_Query([
    'post_type' => 'producthunt',
    'posts_per_page' => 10,
]);
if($products_query->have_posts()): while($products_query->have_posts()): $products_query->the_post(); ?>
        <li class="post-3-li post-list-item" id="item-<?php echo get_the_ID();?>">
            <div class="item-in">
                <div class="post-module-thumb mobile-hidden" style="">
                    <div style="padding-top: 74%;" class="b2-radius">
                        <div class="post-pay-type">
                            <div>
                                <span class="post-pay-type-icon"><i class="b2font b2-download1"></i><b>下载</b></span><span>1个资源</span>
                            </div>
                        </div>
                        <a target="_blank" rel="nofollow" class="thumb-link">
                            <img src="<?php echo get_the_post_thumbnail_url(get_the_ID());?>">
                        </a>
                    </div>
                </div>
                <div class="post-module-thumb mobile-show" style="">
                    <div style="padding-top: 80%;" class="b2-radius">
                        <div class="post-pay-type">
                            <div>
                                <span class="post-pay-type-icon"><i class="b2font b2-download1"></i><b>下载</b></span><span>1个资源</span>
                            </div>
                        </div>
                        <a target="_blank" rel="nofollow" class="thumb-link">
                            <img src="<?php echo get_the_post_thumbnail_url(get_the_ID());?>">
                        </a>
                    </div>
                </div>
                <div class="post-info">
                    <div>
                        <div class="post-list-cat b2-radius">
                            <?php
                            $terms = get_the_terms(get_the_ID(), 'productcat');
                            foreach ($terms as $term) {
                                echo '<a target="_blank" class="post-list-cat-item b2-radius" href="'. get_term_link($term). '" style="color: #b48faa;">'. $term->name. '</a>';
                            }
                            ?>
                        </div>
                    </div>
                    <h2><a target="_blank" href="https://b2.7b2.com/42760.html"><?php echo get_the_title();?></a></h2>
                    <div class="post-excerpt">
                        <?php echo get_the_excerpt();?>
                    </div>

                    <div class="post-list-meta-box">
                        <ul class="post-list-meta">
                            <li class="post-list-meta-user">
                                <a class="post-list-meta-avatar" href="">
                                    <img src="<?php echo get_avatar_url(get_the_author_meta('ID'));?>">
                                    <span><?php echo get_the_author();?></span>
                                </a>
                            </li>
                            <li class="post-list-meta-date">
                                <span><time class="b2timeago" datetime="2022-06-01 23:14:17" itemprop="datePublished">22年6月1日</time></span>
                            </li>
                            <li class="post-list-meta-like">
                                <span><i class="b2font b2-heart-fill"></i>7</span>
                            </li>
                            <li class="post-list-meta-comment">
                                <span><i class="b2font b2-chat-2-fill"></i><?php echo get_comments_number();?></span>
                            </li>
                            <li class="post-list-meta-views">
                                <span><i class="b2font b2-eye-fill"></i>18.1k</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </li>
<?php endwhile;else:?>
    <div>no posts found</div>
<?php endif;  wp_reset_postdata();?>